﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using FineUI;
using SDLITS.Common;
using SDLITS.Model;
using MySoft.Data;
namespace SDLITS.Web.Customer
{
    public partial class ContractView : CommonBase
    {
        public Contract con;
        public Expense exp;
        #region 页面初始化
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["id"]))
                {
                    con = SDDbSession.Default.From<Contract>().Where(Contract._.ContractID == Request["id"]).ToFirst();
                    if (!string.IsNullOrEmpty(con.CompanyID.ToString()))
                    {
                        exp = SDDbSession.Default.From<Expense>().Where(Expense._.CompanyID == con.CompanyID && Expense._.ExpenseTypeID == 2).OrderBy(Expense._.ExpenseID.Asc).ToFirst();
                        if (exp == null)
                        {
                            exp = new Expense { PreMonthAmount = 0 };
                        }
                    }
                }
            }
        }
        #endregion
        public string GetRoom(string id)
        {
            return SDDbSession.Default.From<Room>().Where(Room._.RoomID == id).ToFirst().RoomName;
        }
    }
}